import java.util.*;

public class Answer1 {
    // 数字统计
    //https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a?tpId=290&tqId=39941&ru=/exam/oj
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int l=in.nextInt();
        int r=in.nextInt();

        int ret  = 0;
        for(int i=l; i<=r;i++){
            int tem=i;
            while(tem !=0){
                if(tem%10 == 2){
                    ret ++;
                }
                tem/=10;
            }
        }
        System.out.println(ret);
    }
}
